from django.test import TestCase
from .models import User,UserProfile,Member,gametest
# Create your tests here.
# tests.py


class UPTestCase(TestCase):
    def setUp(self):
        self.user = User.objects.create(username='csh')
        self.up = UserProfile.objects.create(name='测试名', user=self.user)
    def test_book_author_relation(self):
        # 验证书籍的作者是否正确
        self.assertEqual(self.user, self.up)

    def test_author_books(self):
        # 验证通过作者能查询到正确的书籍
        self.assertQuerysetEqual(self.user.profile, self.up)